package by.dkusch.aircompany.model.tables;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import by.dkusch.aircompany.model.tables.base.BaseEntity;
import by.dkusch.aircompany.model.tables.enums.FormType;

@Entity
public class UserGrant extends BaseEntity<Long> {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@NotNull
	@Size(max = 30)
	@Column
	private String code;

	@NotNull
	@ManyToOne(fetch = FetchType.LAZY, targetEntity = UserProfile.class)
	private UserProfile userProfile;

	@NotNull
	@Column
	@Enumerated(EnumType.ORDINAL)
	private FormType formId;

	@Column
	private Boolean viewFl;

	@Column
	private Boolean editFl;

	@Column
	private Boolean deleteFl;

	@Size(max = 30)
	@Column
	private String description;

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public UserProfile getUserProfile() {
		return userProfile;
	}

	public void setUserProfile(UserProfile userProfile) {
		this.userProfile = userProfile;
	}

	public FormType getFormId() {
		return formId;
	}

	public void setFormId(FormType formId) {
		this.formId = formId;
	}

	public Boolean getViewFl() {
		if (viewFl == null) {
			viewFl = false;
		}
		return viewFl;
	}

	public void setViewFl(Boolean viewFl) {
		this.viewFl = viewFl;
	}

	public Boolean getEditFl() {
		if (editFl == null) {
			editFl = false;
		}
		return editFl;
	}

	public void setEditFl(Boolean editFl) {
		this.editFl = editFl;
	}

	public Boolean getDeleteFl() {
		if (deleteFl == null) {
			deleteFl = false;
		}
		return deleteFl;
	}

	public void setDeleteFl(Boolean deleteFl) {
		this.deleteFl = deleteFl;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

}
